package com.sihai.ehr.service;

import java.util.List;

import com.sihai.core.BaseEntity;
import com.sihai.core.Limit;
import com.sihai.core.LimitedList;
import com.sihai.core.Sorter;
import com.sihai.ehr.model.biz.EmployeeWorkExperience;
import com.sihai.ehr.model.biz.EmployeeinfoBase;
import com.sihai.ehr.model.biz.EmployeeinfoEducation;
import com.sihai.ehr.model.biz.EmployeeinfoFamily;
import com.sihai.ehr.model.biz.EmployeeinfoTrain;
import com.sihai.ehr.model.biz.EmployeeinfoWork;
import com.sihai.ehr.web.pojo.EmployeeNoPojo;
import com.sihai.ehr.web.pojo.EmployeeinfoBasePojo;
import com.sihai.ehr.web.pojo.StaffSearchPojo;

public interface EmployeeService {

	/**
	 * 保存员工基本信息
	 * 
	 * @param employeeinfoBase
	 */
	void saveEmployeeBase(EmployeeinfoBase employeeinfoBase);

	/**
	 * 保存员工任职情况
	 * 
	 * @param employeeinfoWork
	 */
	void saveEmployeeinfoWork(EmployeeinfoWork employeeinfoWork);

	/**
	 * 保存员工教育情况
	 * 
	 * @param employeeinfoEducation
	 */
	void saveEducation(EmployeeinfoEducation employeeinfoEducation);

	/**
	 * 保存员工培训情况
	 * 
	 * @param employeeinfoTrain
	 */
	void saveEmployeeTrain(EmployeeinfoTrain employeeinfoTrain);

	/**
	 * 保存员工工作经历
	 * 
	 * @param employeeWorkExperience
	 */
	void saveEmployeeExperience(EmployeeWorkExperience employeeWorkExperience);

	/**
	 * 保存员工家庭情况
	 * 
	 * @param employeeinfoFamily
	 */
	void saveEmployeeFamily(EmployeeinfoFamily employeeinfoFamily);

	/**
	 * 获取员工信息列表
	 * 
	 * @param employeeinfoBase
	 * @param limit
	 * @param sorter
	 * @return
	 */
	LimitedList<EmployeeinfoBase> searchEmployeeinfoBase(
			final EmployeeinfoBase employeeinfoBase, final int state,
			Limit limit, Sorter sorter);

	/**
	 * 查询非正式员工列表
	 * 
	 * @param limit
	 * @param sorter
	 * @return
	 */
	LimitedList<EmployeeinfoBasePojo> queryEmployeeinfoBasesForNOffical(
			Limit limit, Sorter sorter);

	/**
	 * 根据员工编号获取员工任职信息
	 * 
	 * @param employeeId
	 * @return
	 */
	public EmployeeinfoWork getEmplyeeinfoWorkByBaseId(Long employeeId);

	/**
	 * 员工任职情况
	 * 
	 * @param search
	 * @param organizationId
	 * @param limit
	 * @param sorter
	 * @return
	 */
	LimitedList<EmployeeinfoWork> searchEmployeeinfoWorks(
			StaffSearchPojo search, Long organizationId, final String state,
			Limit limit, Sorter sorter);

	/**
	 * 根据部门ID获取统计员工
	 * 
	 * @param orgId
	 * @return
	 */
	Long getTotalCountByOrganizationId(Long orgId,boolean isReadChild);
	
	/**
	 * 根据薪资结构ID获取员工人数
	 * @param structId
	 * @return
	 */
	Long getTotalCountBySalaryStructId(Long structId);

	/**
	 * 根据主键获取员工基本信息
	 * 
	 * @param id
	 * @return
	 */
	EmployeeinfoBase getEmployeeinfoBase(Long id);

	// add.wxn : 查找任务代理人
	List<EmployeeinfoBase> findForDutyProxy(String type, String name);

	/**
	 * 查找员工最大工号，没有就显示QS000001 emp 工号开头部分
	 * 
	 * @return
	 */
	String getEmployeeNo(String emp);

	/**
	 * 删除员工
	 * 
	 * @param strIds
	 * @param state
	 */
	void removeEmployee(final String strIds, int state);

	/**
	 * 删除员工相关信息
	 * 
	 * @param id
	 */
	void removeEmpRelate(Long id, int state);

	// void updateEmployeeinfoBase(EmployeeinfoBase employeeinfoBase);

	void updateEmployeeRelatedEntity(BaseEntity entity);

	EmployeeinfoWork getEmployeeinfoWork(Long id);

	/**
	 * 员工教育情况
	 * 
	 * @param employeeinfoBase
	 * @param limit
	 * @param sorter
	 * @return
	 */
	List<EmployeeinfoEducation> getEducationList(
			EmployeeinfoBase employeeinfoBase, Limit limit, Sorter sorter);

	/**
	 * 员工培训情况
	 * 
	 * @param employeeinfoBase
	 * @param limit
	 * @param sorter
	 * @return
	 */
	List<EmployeeinfoTrain> getTrainList(EmployeeinfoBase employeeinfoBase,
			Limit limit, Sorter sorter);

	/**
	 * 员工工作经历
	 * 
	 * @param employeeinfoBase
	 * @param limit
	 * @param sorter
	 * @return
	 */
	List<EmployeeWorkExperience> getWorkExperienceList(
			EmployeeinfoBase employeeinfoBase, Limit limit, Sorter sorter);

	/**
	 * 获取家庭关系
	 * 
	 * @param employeeinfoBase
	 * @param limit
	 * @param sorter
	 * @return
	 */
	List<EmployeeinfoFamily> getEmployeeFamilyList(
			EmployeeinfoBase employeeinfoBase, Limit limit, Sorter sorter);

	public EmployeeinfoEducation getEmployeeinfoEducationById(Long id);

	public EmployeeinfoTrain getEmployeeinfoTrainById(Long id);

	public EmployeeWorkExperience getEmployeeWorkExperienceById(Long id);

	public EmployeeinfoFamily getEmployeeFamilyById(Long id);

	public EmployeeNoPojo getEmployeeNoInfoByOrgId(Long orgId);

    EmployeeinfoWork findBySalaryNo(String salaryNo)throws Exception;

    void  initMemberDB()throws Exception;
}
